package scau.mis4.chanyulin.view;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox;
import javafx.stage.DirectoryChooser;
import scau.mis4.chanyulin.tools.NetworkChecker;
import scau.mis4.chanyulin.tools.utils.DbUtils;
import scau.mis4.chanyulin.tools.utils.UiUtils;

/**
 * Created by cyl on 2017/12/18.
 * 公共对象
 */
public class Global {

    /** 数据库 */
    public static final String SENSOR_TABLE_NAME = DbUtils.getDbName();
    public static final String DB_URI = DbUtils.getIP();

    /** 天气API */
    public static String city = "广州";
    public static final String OUT_ROOT_URL = "www.sojson.com";
    public static final String OUT_API_URL = "www.sojson.com/open/api/weather/json.shtml?city=";

    /** 公共工具 */
    public static final NetworkChecker DB_CONN_CHECKER = new NetworkChecker(DB_URI);
    public static final NetworkChecker OUT_TEMP_CONN_CHECKER = new NetworkChecker(OUT_ROOT_URL);

    /** 控件 */
    public static final ImageView TEMP_GREEN = UiUtils.getImage("/images/temp_green.png");
    public static final ImageView OUT_GREEN = UiUtils.getImage("/images/out_green.png");
    public static final ImageView DB_GREEN = UiUtils.getImage("/images/db_green.png");
    public static final ImageView DB_GREY = UiUtils.getImage("/images/db_grey.png");
    public static final ImageView TEMP_RED = UiUtils.getImage("/images/temp_red.png");
    public static final ImageView TEMP_GREY = UiUtils.getImage("/images/temp_grey.png");
    public static final ImageView OUT_RED = UiUtils.getImage("/images/out_red.png");
    public static final ImageView OUT_GREY = UiUtils.getImage("/images/out_grey.png");
    public static final ImageView DB_RED = UiUtils.getImage("/images/db_red.png");
    public static final ImageView EXP_GREY = UiUtils.getImage("/images/export_grey.png");
    public static final ImageView EXP_DARKGREY = UiUtils.getImage("/images/export_darkgrey.png");
    public static final ImageView SETTINGS_GREY = UiUtils.getImage("/images/settings_grey.png");
    public static final ImageView SETTINGS_DARKGREY = UiUtils.getImage("/images/settings_darkgrey.png");

    /** 主界面控件 */
    public static VBox senTempImgBox = new VBox(TEMP_GREEN);
    public static VBox outTempImgBox = new VBox(OUT_GREEN);
    public static VBox dbImgBox = new VBox(DB_GREEN);
    public static StringProperty senTempProp = new SimpleStringProperty();
    public static StringProperty outTempProp = new SimpleStringProperty();
    public static StringProperty dbProp = new SimpleStringProperty();

    /** 路径选择窗口 */
    public static final DirectoryChooser DATA_EXPORT_DIR_CHOOSER = new DirectoryChooser();

}
